Add libxen to overall xen build via a config option in Config.mk.
authorjfehlig@jfehlig2.provo.novell.com <jfehlig@jfehlig2.provo.novell.com>
Wed, 22 Nov 2006 21:25:07 +0000 (14:25 -0700)
committerjfehlig@jfehlig2.provo.novell.com <jfehlig@jfehlig2.provo.novell.com>
Wed, 22 Nov 2006 21:25:07 +0000 (14:25 -0700)
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Config.mk
tools/Makefile
tools/libxen/Makefile

index 4cd113d905bdc54ebf974044ed92126742cff8d6..364c7231c4b538511eac77dc5e9fbc0550510bd2 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -71,5 +71,6 @@ ACM_DEFAULT_SECURITY_POLICY ?= ACM_NULL_POLICY
 XENSTAT_XENTOP ?= y
 
 VTPM_TOOLS ?= n
+LIBXENAPI_BINDINGS ?= n
 
 -include $(XEN_ROOT)/.config
index fa9d63da16df29344b16a7c2965b6e22dfa56d0f..0eae0edff528b8f20971a5c90dcb01223a8b82f5 100644 (file)
@@ -19,6 +19,7 @@ SUBDIRS-y += xenstat
 SUBDIRS-y += libaio
 SUBDIRS-y += blktap
 SUBDIRS-y += libfsimage
+SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
 
 # These don't cross-compile
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
index 88755ab6dc979c1c7f36f64d48bd207e49b45f15..c944b952159ef112919adfe764698e5e3f312c04 100644 (file)
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 #
+XEN_ROOT=../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR = 0.1
+MINOR = 0
 
 CFLAGS = -Iinclude                     \
-         $(shell xml2-config --cflags) \
+        $(shell xml2-config --cflags) \
          $(shell curl-config --cflags) \
          -W -Wall -Wmissing-prototypes -Werror -std=c99 -O2 -fPIC
 
 LDFLAGS = $(shell xml2-config --libs) \
           $(shell curl-config --libs)
 
-test/test_bindings: test/test_bindings.o src/libxen.so
-       $(CC) $(LDFLAGS) -o $@ $< -L src -lxen
+LIBXENAPI_HDRS = $(wildcard include/*.h)
+LIBXENAPI_OBJS = $(patsubst %.c, %.o, $(wildcard src/*.c))
+
+
+.PHONY: all
+all: libxenapi.so libxenapi.a
+
+libxenapi.so: libxenapi.so.$(MAJOR)
+       ln -sf $< $@
+
+libxenapi.so.$(MAJOR): libxenapi.so.$(MAJOR).$(MINOR)
+       ln -sf $< $@
+
+libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
+
+libxenapi.a: $(LIBXENAPI_OBJS)
+       $(AR) rcs libxenapi.a $^
+
 
-src/libxen.so: $(patsubst %.c, %.o, $(wildcard src/*.c))
-       $(CC) -shared -o $@ $^
+.PHONY: install
+install: all
+       $(INSTALL_DIR) -p $(DESTDIR)/usr/include/xen/api
+       $(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
+       $(INSTALL_PROG) libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
+       ln -sf libxenapi.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenapi.so.$(MAJOR)
+       ln -sf libxenapi.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenapi.so
+       $(INSTALL_DATA) libxenapi.a $(DESTDIR)/usr/$(LIBDIR)
+       for i in $(LIBXENAPI_HDRS); do \
+           $(INSTALL_DATA) $$i $(DESTDIR)/usr/include/xen/api; \
+       done
 
 .PHONY: clean
 clean:
        rm -f `find -name *.o`
-       rm -f src/libxen.so
+       rm -f libxenapi.so*
+       rm -f libxenapi.a
        rm -f test/test_bindings